import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { HttpModule, Http, XSRFStrategy } from '@angular/http';
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
import { AppComponent } from './app.component';
import { TranslateMissingHandler } from './core/common/TranslateMissingHandler';
import { ModalModule } from 'ngx-bootstrap';
import { CoreModule } from './core/core.module';
import { LayoutModule } from './layout/layout.module';
import { CloudSharedModule } from './shared/shared.module';
import { RoutesModule } from './routes/routes.module';
import { CustomFormsModule } from 'ng2-validation';
import { FormsModule } from '@angular/forms';
import { ConfigService } from './core/common/config.service';
import { DefaultRequestOptions, requestOptionsProvider } from './core/http/default-request-options.service';
import { LocalXSRFStrategy } from './core/http/local-xsrf-strategy.service';
import { LocationStrategy, HashLocationStrategy } from '@angular/common';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { TranslateModule, TranslateLoader, MissingTranslationHandler } from '@ngx-translate/core';
export function createTranslateLoader(http: Http) {
  return new TranslateHttpLoader(http, './assets/i18n/', '.json');
}

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    HttpModule,
    BrowserModule,
    BrowserAnimationsModule,
    CoreModule,
    LayoutModule,
    CloudSharedModule.forRoot(),
    ModalModule.forRoot(),
    RoutesModule,
    CustomFormsModule,
    FormsModule,
    TranslateModule.forRoot({
      loader: {
        provide: TranslateLoader,
        useFactory: (createTranslateLoader),
        deps: [Http]
      },
        missingTranslationHandler: {provide: MissingTranslationHandler, useClass: TranslateMissingHandler},
    })
  ],
  providers: [ConfigService, requestOptionsProvider, DefaultRequestOptions, {
    provide: LocationStrategy,
    useClass: HashLocationStrategy
  },
    {
      provide: XSRFStrategy, useClass: LocalXSRFStrategy,
    }],
  bootstrap: [AppComponent]
})
export class AppModule { }
